function minStartValue(nums: number[]): number {
    let ans: number = 0
    nums.reduce((sum,item) => {
        sum += item
        if(sum < ans){
            ans = sum
        }
        return sum
    },0)
    return -ans + 1
};


const nums: number[] = [-3,2,-3,4,2]
console.log(minStartValue(nums))